﻿@{
	Layout = "~/Views/Shared/_Layout.cshtml";
}

@model dPet.Application.DataObjects.BillTemplateDto

<div class="page-header">
	<h3>票据模板配置</h3>
</div>

@using (Html.BeginForm("SaveBillTemplateConfig", "Config", FormMethod.Post, new { onsubmit = "return check_form()" }))
{
	<div class="panel panel-default">
		<div class="panel-heading">
			&nbsp;
		</div>

		<div class="panel-body form-horizontal">
			<div class="form-group">
				<label for="BillTitle" class="col-md-1 control-label">票据标题</label>
				<div class="col-md-3">
					@Html.TextBoxFor(x => x.BillTitle, new { @class = "form-control", placeholder = "请输入票据标题" })
				</div>
			</div>

			<div class="form-group">
				<label for="Address" class="col-md-1 control-label">医院地址</label>
				<div class="col-md-3">
					<div class="input-group">
						@Html.TextBoxFor(x => x.Address, new { @class = "form-control", placeholder = "请输入医院地址" })
						<span class="input-group-addon">
							显示 @Html.CheckBoxFor(x => x.ShowAddress)
						</span>
					</div>
				</div>
			</div>

			<div class="form-group">
				<label for="PhoneNumber" class="col-md-1 control-label">医院电话</label>
				<div class="col-md-3">
					<div class="input-group">
						@Html.TextBoxFor(x => x.PhoneNumber, new { @class = "form-control", placeholder = "请输入医院电话" })
						<span class="input-group-addon">
							显示 @Html.CheckBoxFor(x => x.ShowPhoneNumber)
						</span>
					</div>
				</div>
			</div>

			<div class="form-group">
				<label for="FaxNumber" class="col-md-1 control-label">医院传真</label>
				<div class="col-md-3">
					<div class="input-group">
						@Html.TextBoxFor(x => x.FaxNumber, new { @class = "form-control", placeholder = "请输入医院传真" })
						<span class="input-group-addon">
							显示 @Html.CheckBoxFor(x => x.ShowFaxNumber)
						</span>
					</div>
				</div>
			</div>

			<div class="form-group">
				<label for="FootText" class="col-md-1 control-label">底部文字</label>
				<div class="col-md-3">
					@Html.TextBoxFor(x => x.FootText, new { @class = "form-control", placeholder = "请输入底部文字" })
				</div>
			</div>

			<div class="form-group">
				<div class="col-md-offset-1 col-md-3">
					<button id="btn_priview" type="button" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-eye-open"></span> 预 览</button>
					<button type="submit" class="btn btn-info btn-sm"><span class="glyphicon glyphicon-floppy-disk"></span> 保 存</button>
				</div>
			</div>
		</div>
	</div>
}

@section scripts {
	<script type="text/javascript">
		$(document).ready(function () {
			set_left_nav('#ln_BillTemplateConfig');
		});

		function check_form() {
			return confirm("是否保存当前模板?");
		}

		$("#btn_priview").bind("click", function () {
			var paras = [];

			paras.push("BillTitle=" + $("#BillTitle").val());
			paras.push("Address=" + $("#Address").val());
			paras.push("ShowAddress=" + $("#ShowAddress").prop("checked"));
			paras.push("PhoneNumber=" + $("#PhoneNumber").val());
			paras.push("ShowPhoneNumber=" + $("#ShowPhoneNumber").prop("checked"));
			paras.push("FaxNumber=" + $("#FaxNumber").val());
			paras.push("ShowFaxNumber=" + $("#ShowFaxNumber").prop("checked"));
			paras.push("FootText=" + $("#FootText").val());

			window.open("/Config/PriviewBillTemplate?" + paras.join("&"), "_blank", 'width=600,height=500');
		})
	</script>
}
